<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class RedisSubscribe extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'app:redis-subscribe';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $redis = app('redis');
        $redis->psubscribe(['*'], function ($message) {
            echo "Received message: {$message}\n";
        });
    }
}
